<?php
/**
 * mail.class.php 邮件类
 *
 * 支持批量上传
 *
 * @author          hyperblue
 * @version         0.1
 * @copyright       (C) 2011- *
 * @license	        http://www.bingceng.com
 * @lastmodify	    2011-08-25 14:50
 */
 
defined('BC_INC_PATH') or exit("Access Denied!");


require_once BC_INC_PATH.'PHPMailer/class.phpmailer.php';
 
class mail {

	/*
	 * Construct
	 *
	 * @return void
	 */
	function __construct() {
	}
	
	function sendMail($to,$subject = "",$body = ""){
    	//error_reporting(E_STRICT);
    	date_default_timezone_set("Asia/Shanghai");
    	$mail = new PHPMailer();
    	$mail->CharSet ="UTF-8";
    	$mail->IsSMTP();
		//$mail->IsMail();
   		$mail->SMTPDebug  = 1; 
    	$mail->SMTPAuth   = true; 
    	$mail->SMTPSecure = "ssl";
    	$mail->Host = "smtp.qq.com";
    	$mail->Port = 465;
    	$mail->Username = "";
    	$mail->Password = "";
		
		$mail->From = ""; 
		$mail->FromName = "";
    	$mail->Subject = $subject;
		$mail->AltBody = "This is the body when user views in plain text format";
		$mail->WordWrap = 50;
    	$body = eregi_replace("[\]",'',$body); 
		$mail->Body = $body;
		
    	$address = $to;
    	$mail->AddAddress($address, "");
    	//$mail->AddAttachment("images/phpmailer.gif");      // attachment 
    	//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
		$mail->IsHTML(true); 
    	if(!$mail->Send()) {
        	echo "Mailer Error: " . $mail->ErrorInfo;
    	} else {
       	 	echo "Message sent!恭喜，邮件发送成功！";
        }
    }

}
?>
